﻿using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;

namespace AspNetIdentity.Models
{
    /// <summary>
    /// 验证信息本地化
    /// </summary>
    public class ErrorDescriber : IdentityErrorDescriber
    {  /// <summary>
       /// Returns an <see cref="IdentityError"/> indicating the specified <paramref name="userName"/> already exists.
       /// </summary>
       /// <param name="userName">The user name that already exists.</param>
       /// <returns>An <see cref="IdentityError"/> indicating the specified <paramref name="userName"/> already exists.</returns>
        public override IdentityError DuplicateUserName(string userName)
        {
            return new IdentityError
            {
                Code = nameof(DuplicateUserName),
                Description = "用户名已存在"
            };
        }
    }
}
